package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppCompanyComparison;
import com.ep.modules.app.service.AppCompanyComparisonService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/company_comparison")
public class AppCompanyComparisonController {
    @Autowired
    private AppCompanyComparisonService appCompanyComparisonService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appCompanyComparisonService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppCompanyComparison appcompanycomparison = appCompanyComparisonService.getById(id);
        return R.ok().put("appcompanycomparison", appcompanycomparison);
    }

    @SysLog("保存AppCompanyComparison")
    @PostMapping("/save")
    public R save(@RequestBody AppCompanyComparison appcompanycomparison) {
        ValidatorUtils.validateEntity(appcompanycomparison);
        appCompanyComparisonService.save(appcompanycomparison);
        return R.ok();
    }

    @SysLog("修改AppCompanyComparison")
    @PostMapping("/update")
    public R update(@RequestBody AppCompanyComparison appcompanycomparison) {
        ValidatorUtils.validateEntity(appcompanycomparison);
        appCompanyComparisonService.update(appcompanycomparison);
        return R.ok();
    }

    @SysLog("删除AppCompanyComparison")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appCompanyComparisonService.deleteBatch(ids);
        return R.ok();
    }
}